<?php
$this->breadcrumbs=array(
    'Quản trị'=>array('/admin'),
    'Học viên'=>array('index'),
    'Danh sách',
);

$this->menu=array(
    array('label'=>'Thêm mới', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('students-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Danh sách học viên</h1>

<?php echo CHtml::link('Tìm kiếm','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
    <?php $this->renderPartial('_search',array(
    'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'students-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        ///'id',
        'name',
        'email',
        'tel',
        array(
            'name'=>'birthday',
            'value'=>'date("d/m/Y",$data->birthday)',
            'filter'=>false,
        ),
        array(
            'name'=>'user_id',
            'value'=>'$data->user->username'
        ),
        array(
            'class'=>'CButtonColumn',
        ),
    ),
)); ?>
